<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="cw" uri="/widget-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<%@ include file="/pages/include/nocache.jsp"%>
		<title>企业退休待遇核定</title>
		<cw:base></cw:base>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/resource/newscripts/gridUtils.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/resource/newscripts/formUtils.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/resource/newscripts/dateUtils.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/resource/scripts/windowUtils.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/resource/newscripts/storeUtils.js"></script>
		<script type="text/javascript"
			src="${pageContext.request.contextPath}/resource/newscripts/format.js"></script>
		<script type="text/javascript" 
			src="${pageContext.request.contextPath}/resource/newscripts/utils.js"></script>
		<script type="text/javascript" 
			src="${pageContext.request.contextPath}/resource/newscripts/gridException.js"></script>
		<script type="text/javascript">
			function selectPerson(combo,record,index){
				Yzsb.form.reset('form1');
				cleanGridData('dymxGrid');
				cleanGridData('pjjfGrid');
				cleanGridData('pjjf1995Grid');
				cleanGridData('zdjfxsGrid');
				Ext.getCmp('submit_button').disable();
				
				/*Ext.getCmp('print_button').disable();
				Ext.getCmp('print_button_1').disable();
				Ext.getCmp('print_button_2').disable();
				Ext.getCmp('print_button_3').disable();
				Ext.getCmp('print_button_4').disable();*/
				
				var aac001 = record.get('aac001');
				var tagemptyok = Ext.getCmp('tagemptyok_hidden').getValue();
			    Ext.getCmp('aac001_hidden').setValue(aac001);
				
				Wonders.utils.formLoad(
					'form1', 
					'${pageContext.request.contextPath}/i1/f30120201/corpRetireAuthPreQuery.action', 
					{aac001:aac001},
					function(form,action){
						var bab002_hidden = Ext.getCmp('common_aaa027').getValue();
						Ext.getCmp('bab002_hidden').setValue(bab002_hidden);
						var aac003_hidden = Ext.getCmp('aac003').getValue();
						Ext.getCmp('aac003_hidden').setValue(aac003_hidden);
						var ac98s_aic164 = getFormValue(action,'ac98s_aic164');
						var ac98s_bae071 = getFormValue(action,'ac98s_bae071');
						var ic62s = getFormValue(action,'ic62s');
						var tag_OneByOneCorpContri = getFormValue(action, 'tag_OneByOneCorpContri');
						
						loadGridData('pjjfGrid',ac98s_aic164);
						loadGridData('pjjf1995Grid',ac98s_bae071);
						loadGridData('zdjfxsGrid',ic62s);
						
						Ext.getCmp('button_calc').enable();
						if(tag_OneByOneCorpContri == 1){
							//Ext.getCmp('print_button_3').enable();
							Wonders.Msg.info(getFormValue(action, 'msg_OneByOneCorpContri'));
						}else{
							//Ext.getCmp('print_button_3').disable();
						}
					}
				);
				
			}
			
		  function onSubmit(){
		  	var jsonData_1 = getGridJosnData('pjjfGrid',false);		
			Ext.getCmp('jsonData_1_hidden').setValue(jsonData_1);
			
			var jsonData_2 = getGridJosnData('pjjf1995Grid',false);		
			Ext.getCmp('jsonData_2_hidden').setValue(jsonData_2);
			
			var jsonData_3 = getGridJosnData('zdjfxsGrid',false);	 	
			Ext.getCmp('jsonData_3_hidden').setValue(jsonData_3);
			
			Wonders.utils.formSubmit(
				Ext.getCmp('submit_button'),
				'form1',
				function(form,action){
					var aaz170 = getFormValue(action,'aaz170');
					var aac057 = getFormValue(action,'aac057');
					var flag_rlcs = getFormValue(action,'flag_rlcs');
					var msg = '';
					//alert(getFormValue(action,'aaz170'));
					Ext.getCmp('aaz170_hidden').setValue(aaz170);
					Ext.getCmp('aac057_cmp').setValue(aac057);
					Ext.getCmp('print_button').enable();
					/*Ext.getCmp('print_button_1').enable();
					Ext.getCmp('print_button_2').enable();
					Ext.getCmp('print_button_4').enable();*/
					if(flag_rlcs && flag_rlcs=='1'){
						msg = '该人员可以进行人脸识别测试!';
					}
					Wonders.Msg.info('提交保存成功!'+msg,'提示');
					/*Ext.Msg.alert('提示','提交保存成功!',function(){
						var isPrint = confirm('您可以进行打印核定,是否继续?');
						if(isPrint){
							alert('谢谢打印');
						}
					});*/
					return false;
				}
			);	        			 	   				 	
		 }	
		 
		 function onPrint(){
		 	var aac001 = Ext.getCmp('aac001_hidden').getValue();
		 	var aic161 = Ext.getCmp('aic161_cmp').getValue();
		 	var aic162 = Ext.getCmp('aic162_cmp').getValue();
			var myDate=new Date();
			myDate.setFullYear(2011,6,1);
			var today = new Date();
			if(aic161=='110106'){
				var urlt = prefixUrl + '/report/printServlet?reportId=f3012066303&params=aac001='+aac001;
				window.open(urlt);
				return false;
			}else{
				if(aic162<myDate){
					var urlt = prefixUrl + '/report/printServlet?reportId=f3012066301&params=aac001='+aac001;
					window.open(urlt);
					return false;
				}else{
					var urlt = prefixUrl + '/report/printServlet?reportId=f3012066302&params=aac001='+aac001;
					window.open(urlt);
					return false;
				}
			}
		 }
		
		 function calcByWay(){
			var aac001 = Ext.getCmp('aac001_hidden').getValue();
			var ccejs = Ext.getCmp('ccejs_cmp').getValue();
			Wonders.utils.formLoad('calcform', 
				'${pageContext.request.contextPath}/i1/f30120201/corpRetireAuthCalcWay.action', 
				{aac001:aac001,ccejs:ccejs},
				function(form,action){
					//Ext.Msg.alert("OK");
				}
			);
		}
		
         function onReset() {
	        Yzsb.form.reset('form1');
			cleanGridData('dymxGrid');
			cleanGridData('pjjfGrid');
			cleanGridData('pjjf1995Grid');
			cleanGridData('zdjfxsGrid');
			Yzsb.form.reset('frmPersonInfo_aac001');
			Ext.getCmp('submit_button').disable();
         }
  		</script>
	</head>
	<body>
		<cw:window url="${pageContext.request.contextPath}/sample/component/grid/baseGrid/gridPage.jsp" id="mychildWindow" width="600" height="300" title="新页面窗口" maximizable="true" minimizable="true" modal="true"/>
		<cw:window id="innerWindow" width="600" height="300" title="我的子窗口" maximizable="true" minimizable="true" modal="true">
			<cw:form id="detail">
				<table>
					<tr>
						<td>
							身份证：
						</td>
						<td>
							<cw:text property="id" readOnly="true"></cw:text>
						</td>
						<td>
							姓名：
						</td>
						<td>
							<cw:text property="name" readOnly="true"></cw:text>
						</td>
					</tr>
					<tr>
						<td>
							性别：
						</td>
						<td>
							<cw:text property="sex" readOnly="true"></cw:text>
						</td>
						<td>
							生日：
						</td>
						<td>
							<cw:text property="dateTime" readOnly="true"></cw:text>
						</td>
					</tr>
					<tr>
						<td>
							民族：
						</td>
						<td>
							<cw:text property="nation" readOnly="true"></cw:text>
						</td>
						<td>
							户籍性质：
						</td>
						<td>
							<cw:text property="census" readOnly="true"></cw:text>
						</td>
					</tr>
					<tr>
						<td>
							户籍所在地：
						</td>
						<td>
							<cw:text property="censusAddress" readOnly="true"></cw:text>
						</td>
						<td>
							邮政编码：
						</td>
						<td>
							<cw:text property="zip" readOnly="true"></cw:text>
						</td>
					</tr>
					<tr>
						<td>
							联系电话：
						</td>
						<td>
							<cw:text property="phone" readOnly="true"></cw:text>
						</td>
						<td>
							手机：
						</td>
						<td>
							<cw:text property="moblie" readOnly="true"></cw:text>
						</td>
					</tr>
					<tr>
						<td>
							开户银行：
						</td>
						<td>
							<cw:text property="bankName" readOnly="true"></cw:text>
						</td>
						<td>
							开卡类型:
						</td>
						<td>
							<cw:text property="cardType" readOnly="true"></cw:text>
						</td>
					</tr>
					<tr>
						<td>
							卡号:
						</td>
						<td>
							<cw:text property="cardNumber" readOnly="true"></cw:text>
						</td>
						<td>
							现金余额:
						</td>
						<td>
							<cw:text property="cash" readOnly="true"></cw:text>
						</td>
					</tr>
				</table>
			</cw:form>
		</cw:window>
		
		<div align="left"><jsp:include
				page="/pages/pub/personSelect.jsp"></jsp:include></div>

		<cw:tab id="infoshow" activeTab="0" >
			<cw:panel title="个人基本信息" header="true" contentId="personinfoshow"
				autoWidth="true" autoHeight="true"></cw:panel>
			
		</cw:tab>
		<div id="personinfoshow">
			<%@ include file="/pages/pub/personInfo.jsp"%>
		</div>
		
		<cw:form id="form1" url="${pageContext.request.contextPath}/i1/f30120201/corpRetireAuthSave.action" waitMsg="提交中，请稍候...">
		<cw:tab id="infoinput" activeTab="0" listeners="{'tabchange':tabChg}">
			<cw:panel id="gridPanel" contentId="grid" title="待遇组成信息" collapsed="false" autoHeight="true"></cw:panel>
			<cw:panel id="grid2Panel" contentId="grid2" title="待遇发放信息" header="true" autoHeight="true"></cw:panel>
			<cw:panel id="grid3Panel" contentId="grid3" title="审批信息" header="true" autoHeight="true"></cw:panel>
			<cw:panel id="grid4Panel" contentId="grid4" title="隐藏全部信息" header="true" autoHeight="true"></cw:panel>
		</cw:tab>
			<cw:text property="bab002" id="bab002_hidden" type="hidden"></cw:text>
			<cw:text property="jsonData_1" id="jsonData_1_hidden" type="hidden"></cw:text>
			<cw:text property="jsonData_2" id="jsonData_2_hidden" type="hidden"></cw:text>
			<cw:text property="jsonData_3" id="jsonData_3_hidden" type="hidden"></cw:text>
			<cw:text id="tagemptyok_hidden" property="tagemptyok" type="hidden" value="1"></cw:text>
			
			<cw:text id="tagProxyCont" property="tagProxyCont" type="hidden" value="1"></cw:text>
			<cw:text property="aac001" id="aac001_hidden" type="hidden"></cw:text>
			<cw:text property="aac003" id="aac003_hidden" type="hidden"></cw:text>
			<cw:text property="aab001" id="aab001_hidden" type="hidden"></cw:text>
			<cw:text property="aaa027" id="aaa027_hidden" type="hidden"></cw:text>
			<cw:text property="aaz257" id="aaz257_hidden" type="hidden"></cw:text>
			<cw:text property="aaz157" id="aaz157_hidden" type="hidden"></cw:text>
			<cw:text property="aaz159" id="aaz159_hidden" type="hidden"></cw:text>
			<cw:text property="aaz261" id="aaz261_hidden" type="hidden"></cw:text>
			<cw:text property="baz039" id="baz039_hidden" type="hidden"></cw:text>
			<cw:text property="aae410" id="aae410_hidden" type="hidden"></cw:text>
			<cw:text property="baz057" id="baz057_hidden" type="hidden"></cw:text>
			<cw:text property="aaa070" id="aaa070_hidden" type="hidden"></cw:text>
			<cw:text property="aaz170" id="aaz170_hidden" type="hidden"></cw:text>
			<div id="grid">
				<%@ include file="f30120201_check.jsp"%>
			</div>
			<div id="grid2">
				<%@ include file="/pages/pub/payway.jsp"%>
			</div>
			<div id="grid3">
				<%@ include file="f30120201_infoInput.jsp"%>
			</div>
			<div id="grid4">
					<!-- 隐藏的字段 -->
	<!-- 帐户中个人缴费部分所占比例 -->
	<cw:number property="aic167" id="aic167_cmp" decimalPrecision="4" allowDecimals="true" type="hidden"></cw:number>
	<!-- 个人账户养老金占基本养老金比例 -->
	<cw:number property="aic166" id="aic166_cmp" decimalPrecision="4" allowDecimals="true" type="hidden"></cw:number>
	<!-- 离退休证号 -->
	<cw:text property="aac057" id="aac057_cmp" type="hidden"></cw:text>
	<!-- 备注 -->
	<cw:text property="aae013" id="aae013_cmp" type="hidden"></cw:text>
	<!-- 现养老金增加额 -->
	<cw:number property="bic064" id="bic064_cmp" decimalPrecision="2" allowDecimals="true" type="hidden"></cw:number>
	<!-- 现办法个人账户养老金计发月数 -->
	<cw:number property="bic055" id="bic055_cmp" type="hidden"></cw:number>
	<!-- 指数化月工资 -->
	<cw:number property="bic054" id="bic054_cmp" decimalPrecision="2" allowDecimals="true" type="hidden"></cw:number>
	<!-- 退休上年度当地职工月平均工资 -->
	<cw:number property="aac026" id="aac026_cmp" decimalPrecision="2" allowDecimals="true" type="hidden"></cw:number>
		<!-- 隐藏的字段 -->
			</div>
		</cw:form>
		<cw:form id="calcform"></cw:form>
		<c:url value="/pages/remote/success.json" var="FORM_URL"></c:url>
		<cw:form id="form_none" url="${FORM_URL}" waitMsg="提交中，请稍候..."></cw:form>
		<div id="pDivAction" style="margin: 0 0 0 0" align="center">
			<table width="100%" border="0" >
		    <COLGROUP>
	    		<COL width='30%' align="right">
				<COL width='5%' align="right">
				<COL width='5%' align="left">
				<COL width='5%' align="right">
				<COL width='5%' align="right">
				<COL width='5%' align="right">
				<COL width='5%' align="right">
				<COL width='30%' align="left">
			</COLGROUP>
			<tr align="center">
				<td>
				</td>
				<td>	
					<cw:button text="提交" id="submit_button" onclick="onSubmit()" disabled="true"></cw:button>
				</td>
				<td>
					<cw:button text="重置" id="reset_button" onclick="onReset();"></cw:button>
				</td>
				<td>
					<cw:button text="打印核定表" onclick="onPrint()" id="print_button" disabled="true"></cw:button>
				</td>
				<td>
					<cw:button text="内部弹出窗口" onclick="function(){Ext.getCmp('innerWindow').show();maxWindow('innerWindow');}" id="pop_button1" ></cw:button>
				</td>
				<td>
					<cw:button text="弹出子窗口" onclick="function(){Wonders.window.show(mychildWindow);}" id="pop_button2" ></cw:button>
				</td>
				<td>
					<cw:button text="添加节假日" onclick="function(){addHoliday();}" id="pop_button3" ></cw:button>
				</td>
				<td>
				</td>
			</tr>
			</table>	
		</div>
		<cw:theme></cw:theme>
		<br>
		<script type="text/javascript" src="${pageContext.request.contextPath}/resource/scripts/windowfix.js"></script>
	</body>
	<script type="text/javascript"> 
	    Ext.onReady(function(){
			Ext.getCmp('button_calc').disable();
			//业务联想
			var aac001 = '${param.aac001}';
			var isBA = '${param.ba}';
			if (isBA) {
				var record = new Ext.data.Record( {
					aac001 : aac001
				});
				var combo = Ext.getCmp('personSelect_aac001');
				//调用gridSelect的onSelect方法
				//selectAPerson(combo, record, 0);
			}
			/*
	    	Wonders.utils.formLoad(
				'calcform', 
				'${pageContext.request.contextPath}/benefitcommon/businessMonthGet.action', 
				{aae140:'110',baa090:'0'},
				function(form,action){
					var aae410 = getFormValue(action,'aae410');
					if(!aae410){
						Ext.MessageBox.alert('提示', '不能执行非业务期的业务');
						disable('personSelect_aac001',true);
						return;
					}
				}
			);*/
			
			if(document.all) {
				window.attachEvent("onscroll", centerMyWindow);
			} else {
				window.addEventListener('scroll', centerMyWindow, false);
			}
		});
	    
	    function tabChg(tab,pan){
			var id = pan.id;
			if(id=="gridPanel") {
				
			} else if(id=="grid2Panel"){
				Wonders.grid.percentColumn("payway_psnlaccountgrid");
				Wonders.grid.percentColumn("payway_corpaccountgrid");
			} else if(id=="grid3Panel") {
				Wonders.grid.percentColumn("pjjfGrid");
				Wonders.grid.percentColumn("pjjf1995Grid");
				Wonders.grid.percentColumn("zdjfxsGrid");
			} else if(id=="grid4Panel") {
				
			}
		}
	    
	    function centerMyWindow(){
			try{
				centerWindow("innerWindow");
			}catch(e){
				
			}
			
			try{
				centerWindow("mychildWindow");
			}catch(e){
				
			}
		}
	    
	    /* 添加节假日 */
		function addHoliday(){
			showChildWindow('holiday',
				'${pageContext.request.contextPath}/pages/example/f30120201/holiday.jsp',
				'',
				'添加节假日',
				600,
				330,
				true,
				true
			);
		}
	    
		/* 关闭子窗口  */
		function closeChildWin(winId){
			closeWindow(winId);
		}
  	</script>
</html>